package com.jie.wlgc;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jie.wlgc.api.HelloApi;

/**
 * Hello world!
 *
 */
@Controller
public class AppController {

    private static final Logger LOGGER = Logger.getLogger(AppController.class);

    @Autowired
    private HelloApi helloApi;

    @RequestMapping(value = "/main", method = RequestMethod.GET)
    public String index(HttpServletRequest request, Model model) {
        String name = helloApi.sayHello();
        LOGGER.info("HelloApp " + name);
        model.addAttribute("name", name);
        return "main";
    }

}
